import React from 'react';
import ReactDOM from 'react-dom';
import { BrowserRouter,Switch, Route, Redirect } from 'react-router-dom';
import { createStore } from 'redux';
import { Provider } from 'react-redux';
import allReducers from './reducers';
import 'antd/dist/antd.less';
import registerServiceWorker from './registerServiceWorker';
import App from './App';
import Login from './pages/login';
import Register from './pages/register';
import Routes from './routes';

const store = createStore(allReducers);

ReactDOM.render(
    <Provider store={store}>
      <BrowserRouter>
        <App>
          <Switch>
            <Route exact path="/" render={() => <Redirect to="/dashboard" />} />
            <Route path="/login" component={Login}></Route>
            <Route path="/register" component={Register}></Route>
            <Routes />
          </Switch>
        </App>
      </BrowserRouter>
    </Provider>
    , document.getElementById('root'));

registerServiceWorker();
